﻿using Mengsk.ProxyDelivery.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mengsk.ProxyDelivery.Print.Domain.PrintDataFormatters
{
    class PrintDataFormatterReceiver_Phone : PrintDataFormatter
    {
        public override PrintTemplateItemTypes AcceptType
        {
            get { return PrintTemplateItemTypes.RECIVER_PHONE; }
        }

        public override object Format(PrintTemplate template, PrintTemplateItem item, Order order)
        {
            //如果电话为空，则座机号码已经被Mobile返回打印，此处无需在打印
            if (string.IsNullOrWhiteSpace(order.ReceiverMobile) && template.Items.Any(obj => obj.Type == PrintTemplateItemTypes.RECIVER_MOBILE))
            {
                return "";
            }
            return order.ReceiverPhone;
        }
    }
}
